const app = Vue.createApp({
  data() {
    return {
      num: 0,
      error: ''
    }
  },
  methods: {
    add() {
      this.error = '';
      if (this.num < 10) {
        this.num++;
      } else {
        this.error = '不能超过10'
      }
    },
    desc() {
      this.error = '';
      if (this.num > 0) {
        this.num--;
      } else {
        this.error = '不能小于0'
      }
    }
  }
})

const vm = app.mount('#app')